package chen.huai.jie.spring.xmlconfig.db.mongo.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.List;

@Document(collection = "student")
public class Message {

    @Id
    private String id;

    @Field("_class")
    private String clazz;

    @Field("name")
    private String name;

    @Field("hobby")
    private List<String> hobby;

    @Field("grade")
    private Grade grade;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getHobby() {
        return hobby;
    }

    public void setHobby(List<String> hobby) {
        this.hobby = hobby;
    }

    public Grade getGrade() {
        return grade;
    }

    public void setGrade(Grade grade) {
        this.grade = grade;
    }

    @Override
    public String toString() {
        return "Message{" +
                "id='" + id + '\'' +
                ", clazz='" + clazz + '\'' +
                ", name='" + name + '\'' +
                ", hobby='" + hobby + '\'' +
                ", grade='" + grade + '\'' +
                '}';
    }

    private class Grade {

        @Field("English")
        private String english;

        @Field("math")
        private String math;

        public String getEnglish() {
            return english;
        }

        public void setEnglish(String english) {
            this.english = english;
        }

        public String getMath() {
            return math;
        }

        public void setMath(String math) {
            this.math = math;
        }

        @Override
        public String toString() {
            return "Grade{" +
                    "english='" + english + '\'' +
                    ", math='" + math + '\'' +
                    '}';
        }
    }
}
